﻿using System;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace PmuRegistry.Silverlight.Converters
{
	public class StringToSymbolConverter : IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			RadialGradientBrush scBrush = new RadialGradientBrush();

			string statusColor = value.ToString();
			if (statusColor.Contains("Green"))
				scBrush = Application.Current.Resources["GreenRadialGradientBrush"] as RadialGradientBrush;
			else if (statusColor.Contains("Gray"))
				scBrush = Application.Current.Resources["GrayRadialGradientBrush"] as RadialGradientBrush;
			else if (statusColor.Contains("Yellow"))
				scBrush = Application.Current.Resources["YellowRadialGradientBrush"] as RadialGradientBrush;
			else if (statusColor.Contains("Red"))
				scBrush = Application.Current.Resources["RedRadialGradientBrush"] as RadialGradientBrush;

			return scBrush as Brush;
		}
		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			return null;
		}

		#endregion
	}
}
